package com.yn.xgame.game;

import java.util.HashMap;
import java.util.Map;

/**
 * CenterManager
 * Created by wangboo on 17/7/15.
 */
public class CenterManager {

    private String name;
    //
    private Map<Integer, RoomManager> map = new HashMap<>();

    CenterManager(String name) {
        this.name = name;
    }

    void addRoomManager(RoomManager roomManager) {
        map.put(roomManager.getId(), roomManager);
    }


    public String getName() {
        return name;
    }

    public int getUserCount() {
        int userCount = 0;
        for (RoomManager rm : map.values()) {
            userCount += rm.getUserCount();
        }
        return userCount;
    }

    public Map<Integer, RoomManager> getRoomMap() {
        return map;
    }

    public RoomManager getRoomManager(int id) {
        return map.get(id);
    }

}
